package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.MaterialMapper;
import com.ruoyi.system.domain.Material;
import com.ruoyi.system.service.IMaterialService;

/**
 * 物资Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-07-14
 */
@Service
public class MaterialServiceImpl implements IMaterialService 
{
    @Autowired
    private MaterialMapper materialMapper;

    /**
     * 查询物资
     * 
     * @param id 物资主键
     * @return 物资
     */
    @Override
    public Material selectMaterialById(String id)
    {
        return materialMapper.selectMaterialById(id);
    }

    /**
     * 查询物资列表
     * 
     * @param material 物资
     * @return 物资
     */
    @Override
    public List<Material> selectMaterialList(Material material)
    {
        return materialMapper.selectMaterialList(material);
    }

    /**
     * 新增物资
     * 
     * @param material 物资
     * @return 结果
     */
    @Override
    public int insertMaterial(Material material)
    {
        material.setCreateTime(DateUtils.getNowDate());
        return materialMapper.insertMaterial(material);
    }

    /**
     * 修改物资
     * 
     * @param material 物资
     * @return 结果
     */
    @Override
    public int updateMaterial(Material material)
    {
        material.setUpdateTime(DateUtils.getNowDate());
        return materialMapper.updateMaterial(material);
    }

    /**
     * 批量删除物资
     * 
     * @param ids 需要删除的物资主键
     * @return 结果
     */
    @Override
    public int deleteMaterialByIds(String[] ids)
    {
        return materialMapper.deleteMaterialByIds(ids);
    }

    /**
     * 删除物资信息
     * 
     * @param id 物资主键
     * @return 结果
     */
    @Override
    public int deleteMaterialById(String id)
    {
        return materialMapper.deleteMaterialById(id);
    }
}
